/*
package com.example.zwlyz.views;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;

import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;

import com.example.zwlyz.R;

import java.util.List;

public class MainActivity extends AppCompatActivity {
    private ImageView ivarticle;
    private ImageView ivshopping;
    private ImageView ivmine;
    private Fragment mContentFragment;
    private FragmentManager mFragmentManager;
    private ArticleFragment articleFragment;
    private ShoppingFragment shoppingFragment;
    private MineFragment mineFragment;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ivarticle = findViewById(R.id.iv_article);
        ivshopping = findViewById(R.id.iv_shopping);
        ivmine = findViewById(R.id.iv_mine);

        initFragment();
        changeFragment(articleFragment);
        mFragmentManager.beginTransaction()
                .add(R.id.fragment_content, articleFragment).commitAllowingStateLoss();
        mContentFragment = articleFragment;
        ivarticle.setSelected(true);

  */
/*      List<Student> list = DBHelper.getInstance(this).selectAllStudent();
        Log.d("", "LIST ==== " + list.size());*//*


    }


    public void onClick(View v) {
        int id = v.getId();
        if (id == R.id.iv_article) {
            ivarticle.setSelected(true);
            ivshopping.setSelected(false);
            ivmine.setSelected(false);
            changeFragment(articleFragment);
        } else if (id == R.id.iv_shopping) {
            ivarticle.setSelected(false);
            ivshopping.setSelected(true);
            ivmine.setSelected(false);
            changeFragment(shoppingFragment);
        } else if (id == R.id.iv_mine) {
            ivarticle.setSelected(false);
            ivshopping.setSelected(false);
            ivmine.setSelected(true);
            changeFragment(mineFragment);
        }
    }

    private void initFragment() {
        mFragmentManager = getSupportFragmentManager();
        articleFragment =new ArticleFragment();
        shoppingFragment =new ShoppingFragment();
        mineFragment =new MineFragment();
    }

    public void changeFragment(Fragment to) {
        if (mContentFragment != null && mContentFragment != to) {
            if (!to.isAdded()) {
                mFragmentManager.beginTransaction().hide(mContentFragment)
                        .add(R.id.fragment_content, to).commitAllowingStateLoss();
            } else {
                mFragmentManager.beginTransaction().hide(mContentFragment)
                        .show(to).commitAllowingStateLoss();
            }
            mContentFragment = to;
        }
    }

}*/
